INSERT INTO Location (LocationKey, Name, Alias, ShortName, Latitude, Longitude) SELECT
'S1004','BLUDHAVEN',NULL,'Bludhaven',37.166221,-82.912463 WHERE NOT EXISTS  ( SELECT 1 FROM
Location WHERE LocationKey = 'S1004')
GO

INSERT INTO Location (LocationKey, Name, Alias, ShortName, Latitude, Longitude) SELECT
'S1006','CENTRAL CITY SS','Central City','Central City 13kV',33.629182,-86.124656 WHERE NOT EXISTS  ( SELECT 1 FROM
Location WHERE LocationKey = 'S1006')
GO

INSERT INTO Location (LocationKey, Name, Alias, ShortName, Latitude, Longitude) SELECT
'S1003','GOTHAM CITY','',NULL,34.813278,-88.626144 WHERE NOT EXISTS  ( SELECT 1 FROM
Location WHERE LocationKey = 'S1003')
GO

INSERT INTO Location (LocationKey, Name, Alias, ShortName, Latitude, Longitude) SELECT
'S1008','MIDWAY CITY','',NULL,35.008525,-82.68366 WHERE NOT EXISTS  ( SELECT 1 FROM
Location WHERE LocationKey = 'S1008')
GO

INSERT INTO Location (LocationKey, Name, Alias, ShortName, Latitude, Longitude) SELECT
'S1001','Metropolis CC',NULL,'Metropolis CC',35.491827,-91.331531 WHERE NOT EXISTS  ( SELECT 1 FROM
Location WHERE LocationKey = 'S1001')
GO

INSERT INTO Location (LocationKey, Name, Alias, ShortName, Latitude, Longitude) SELECT
'S1009','Opal Midway',NULL,'Opal',37.70946,-70.634018 WHERE NOT EXISTS  ( SELECT 1 FROM
Location WHERE LocationKey = 'S1009')
GO

INSERT INTO Asset (AssetTypeID, AssetKey, AssetName, Description, VoltageKV, Spare) SELECT
4, 'S1006B1012', 'Central City 161kV Cap Banks 1-2', NULL,161,0 WHERE NOT EXISTS ( SELECT 1 FROM
Asset WHERE AssetKey = 'S1006B1012')
GO

INSERT INTO CapacitorBankAttributes (AssetID,NumberOfBanks,CapacitancePerBank,CktSwitcher,MaxKV,UnitKV,UnitKVar,NegReactanceTol,PosReactanceTol,Nparalell,Nseries,NSeriesGroup,NParalellGroup,Fused,VTratioBus,NumberLVCaps,NumberLVUnits,LVKVAr,LVKV,LVNegReactanceTol,LVPosReactanceTol,LowerXFRRatio,Nshorted,BlownFuses,BlownGroups,Rv,Rh,Compensated,NLowerGroups,ShortedGroups,Sh) SELECT
(SELECT ID FROM Asset WHERE AssetKey = 'S1006B1012'),2,84000,'1,1',173,13.2,200,0,10,20,7,1,1,1,800,1,1,1,1,0,10,350,0,1,1,1,0,0,1,1,0
GO

INSERT INTO Asset (AssetTypeID, AssetKey, AssetName, Description, VoltageKV, Spare) SELECT
7, 'S1006B1012CR1', 'Central City 161kV Cap Bank 1 Relay', NULL,69,0 WHERE NOT EXISTS ( SELECT 1 FROM
Asset WHERE AssetKey = 'S1006B1012CR1')
GO

INSERT INTO CapacitorBankRelayAttributes (AssetID,OnVoltageThreshhold,CapBankNumber) SELECT
(SELECT ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),1.075,1
GO

INSERT INTO Asset (AssetTypeID, AssetKey, AssetName, Description, VoltageKV, Spare) SELECT
2, 'BLUDHAVEN_13-T1', 'Bludhaven 13 T1', NULL,13,0 WHERE NOT EXISTS ( SELECT 1 FROM
Asset WHERE AssetKey = 'BLUDHAVEN_13-T1')
GO

INSERT INTO BusAttributes (AssetID) SELECT
(SELECT ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1')
GO

INSERT INTO Asset (AssetTypeID, AssetKey, AssetName, Description, VoltageKV, Spare) SELECT
4, 'S1003B1000', 'Gotham City 161-B1004-Caps', NULL,161,0 WHERE NOT EXISTS ( SELECT 1 FROM
Asset WHERE AssetKey = 'S1003B1000')
GO

INSERT INTO CapacitorBankAttributes (AssetID,NumberOfBanks,CapacitancePerBank,CktSwitcher,MaxKV,UnitKV,UnitKVar,NegReactanceTol,PosReactanceTol,Nparalell,Nseries,NSeriesGroup,NParalellGroup,Fused,VTratioBus,NumberLVCaps,NumberLVUnits,LVKVAr,LVKV,LVNegReactanceTol,LVPosReactanceTol,LowerXFRRatio,Nshorted,BlownFuses,BlownGroups,Rv,Rh,Compensated,NLowerGroups,ShortedGroups,Sh) SELECT
(SELECT ID FROM Asset WHERE AssetKey = 'S1003B1000'),5,18000,'1,1,1,1,1',173,9.54,300,0,10,2,10,5,4,0,1400,1,28,167,825,-3,3,100,0,0,0,4000,1500,0,1,1,0
GO

INSERT INTO Asset (AssetTypeID, AssetKey, AssetName, Description, VoltageKV, Spare) SELECT
7, 'S1003B1000CR1', 'Gotham City 161-Cap 1-4 Relays', NULL,0.002,0 WHERE NOT EXISTS ( SELECT 1 FROM
Asset WHERE AssetKey = 'S1003B1000CR1')
GO

INSERT INTO CapacitorBankRelayAttributes (AssetID,OnVoltageThreshhold,CapBankNumber) SELECT
(SELECT ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),1.075,1
GO

INSERT INTO Asset (AssetTypeID, AssetKey, AssetName, Description, VoltageKV, Spare) SELECT
7, 'S1003B1000CR5', 'Gotham City 161-Cap 5 Relay', NULL,0.002,0 WHERE NOT EXISTS ( SELECT 1 FROM
Asset WHERE AssetKey = 'S1003B1000CR5')
GO

INSERT INTO CapacitorBankRelayAttributes (AssetID,OnVoltageThreshhold,CapBankNumber) SELECT
(SELECT ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),1.075,5
GO

INSERT INTO Asset (AssetTypeID, AssetKey, AssetName, Description, VoltageKV, Spare) SELECT
3, 'S1008B1004', 'Midway City 500kV B1004', NULL,500,0 WHERE NOT EXISTS ( SELECT 1 FROM
Asset WHERE AssetKey = 'S1008B1004')
GO

INSERT INTO BreakerAttributes (AssetID,ThermalRating,Speed,TripTime,PickupTime,TripCoilCondition,AirGapResistor) SELECT
(SELECT ID FROM Asset WHERE AssetKey = 'S1008B1004'),5000,0,1500,2000,200,0
GO

INSERT INTO Asset (AssetTypeID, AssetKey, AssetName, Description, VoltageKV, Spare) SELECT
1, 'L1028', 'Keystone-Midway 161kV Line 2', NULL,161,0 WHERE NOT EXISTS ( SELECT 1 FROM
Asset WHERE AssetKey = 'L1028')
GO

INSERT INTO LineAttributes (AssetID) SELECT
(SELECT ID FROM Asset WHERE AssetKey = 'L1028')
GO

INSERT INTO Asset (AssetTypeID, AssetKey, AssetName, Description, VoltageKV, Spare) SELECT
1, 'L1018', 'Keystone-Midway 161kV Line 1', NULL,161,0 WHERE NOT EXISTS ( SELECT 1 FROM
Asset WHERE AssetKey = 'L1018')
GO

INSERT INTO LineAttributes (AssetID) SELECT
(SELECT ID FROM Asset WHERE AssetKey = 'L1018')
GO

INSERT INTO Asset (AssetTypeID, AssetKey, AssetName, Description, VoltageKV, Spare) SELECT
1, 'L1001', 'Metropolis CC 500-B52-1/52-2-(Krypton Line)', 'KRYPTON GENERATION - KRYPTON SW STA 500 KV',500,0 WHERE NOT EXISTS ( SELECT 1 FROM
Asset WHERE AssetKey = 'L1001')
GO

INSERT INTO LineAttributes (AssetID) SELECT
(SELECT ID FROM Asset WHERE AssetKey = 'L1001')
GO

INSERT INTO Asset (AssetTypeID, AssetKey, AssetName, Description, VoltageKV, Spare) SELECT
8, 'S1008GEN', 'Midway City Solar Gen', 'ORION CANDY Factory Solar',161,0 WHERE NOT EXISTS ( SELECT 1 FROM
Asset WHERE AssetKey = 'S1008GEN')
GO

INSERT INTO DERAttributes (AssetID,FullRatedOutputCurrent,VoltageLevel) SELECT
(SELECT ID FROM Asset WHERE AssetKey = 'S1008GEN'),250,161
GO

INSERT INTO Asset (AssetTypeID, AssetKey, AssetName, Description, VoltageKV, Spare) SELECT
2, 'S1006', 'Central City 161', NULL,161,0 WHERE NOT EXISTS ( SELECT 1 FROM
Asset WHERE AssetKey = 'S1006')
GO

INSERT INTO BusAttributes (AssetID) SELECT
(SELECT ID FROM Asset WHERE AssetKey = 'S1006')
GO

INSERT INTO Asset (AssetTypeID, AssetKey, AssetName, Description, VoltageKV, Spare) SELECT
2, 'S1008B2', '161kV Midway', NULL,161,0 WHERE NOT EXISTS ( SELECT 1 FROM
Asset WHERE AssetKey = 'S1008B2')
GO

INSERT INTO BusAttributes (AssetID) SELECT
(SELECT ID FROM Asset WHERE AssetKey = 'S1008B2')
GO

INSERT INTO Asset (AssetTypeID, AssetKey, AssetName, Description, VoltageKV, Spare) SELECT
5, 'L1018-S1', 'Keystone-Midway 161kV Line 1 Segment 1', NULL,0,0 WHERE NOT EXISTS ( SELECT 1 FROM
Asset WHERE AssetKey = 'L1018-S1')
GO

INSERT INTO LineSegmentAttributes (AssetID,Length,R0,X0,R1,X1,ThermalRating,IsEnd) SELECT
(SELECT ID FROM Asset WHERE AssetKey = 'L1018-S1'),4.716,3.471648,15.6251072,0.8827136,4.2897728,1000,1
GO

INSERT INTO Asset (AssetTypeID, AssetKey, AssetName, Description, VoltageKV, Spare) SELECT
5, 'L1018-S2', 'Keystone-Midway 161kV Line 1 Segment 2', NULL,0,0 WHERE NOT EXISTS ( SELECT 1 FROM
Asset WHERE AssetKey = 'L1018-S2')
GO

INSERT INTO LineSegmentAttributes (AssetID,Length,R0,X0,R1,X1,ThermalRating,IsEnd) SELECT
(SELECT ID FROM Asset WHERE AssetKey = 'L1018-S2'),7.074,5.207472,23.4376608,1.3240704,6.4346592,1000,1
GO

INSERT INTO Asset (AssetTypeID, AssetKey, AssetName, Description, VoltageKV, Spare) SELECT
6, 'XFR-1', 'Bludhaven Transformer', NULL,161,0 WHERE NOT EXISTS ( SELECT 1 FROM
Asset WHERE AssetKey = 'XFR-1')
GO

INSERT INTO TransformerAttributes (AssetID,R0,X0,R1,X1,ThermalRating,SecondaryVoltageKV,PrimaryVoltageKV,TertiaryVoltageKV,SecondaryWinding,PrimaryWinding,TertiaryWinding,Tap) SELECT
(SELECT ID FROM Asset WHERE AssetKey = 'XFR-1'),0,0,0,0,1200,19,161,0,2,900,0,1
GO

INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1008')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'L1028') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1008'))
GO

INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1008')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'L1018') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1008'))
GO

INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1001'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1001')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'L1001') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1001'))
GO

INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1006')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'L1028') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1006'))
GO

INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1006')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'L1018') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1006'))
GO

INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1003')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1003'))
GO

INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1003')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1003'))
GO

INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B1004'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1008')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'S1008B1004') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1008'))
GO

INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1006')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'S1006B1012') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1006'))
GO

INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1003')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'S1003B1000') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1003'))
GO
 
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008GEN'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1008')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'S1008GEN') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1008'))
GO

INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1006')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1006'))
GO
 
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1006')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'S1006') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1006'))
GO
 
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1008')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'S1008B2') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1008'))
GO
 
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018-S1'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1006')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'L1018-S1') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1006'))
GO
 
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018-S2'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1008')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'L1018-S2') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1008'))
GO

INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1009')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'L1018') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1009'))
GO

INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1001'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1001')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'L1001') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1001'))
GO
 
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1008')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'S1008B2') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1008'))
GO
 
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1008')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'L1018') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1008'))
GO
 
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008GEN'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1008')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'S1008GEN') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1008'))
GO
 
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1003')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'S1003B1000') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1003'))
GO
 
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1003')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'XFR-1') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1003'))
GO
 
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1003')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'S1008B2') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1003'))
GO
 
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1006')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'S1008B2') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1006'))
GO
 
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1006')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1006'))
GO
 
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1006')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'XFR-1') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1006'))
GO
  
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1004')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1004'))
GO
  
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1004')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'L1018') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1004'))
GO
  
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1004')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'S1006') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1004'))
GO
  
INSERT INTO AssetLocation (AssetID, LocationID) SELECT 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2'),
(SELECT Location.ID FROM Location WHERE LocationKey = 'S1004')
WHERE NOT EXISTS ( SELECT 1 FROM AssetLocation where AssetID = (SELECT ID FROM Asset WHERE AssetKey = 'S1008B2') AND LocationID = (SELECT ID FROM Location WHERE LocationKey = 'S1004'))
GO
  
INSERT INTO AssetConnection (AssetRelationshipTypeID, ChildID, ParentID) SELECT 
1,
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018-S1'),
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018')
WHERE NOT EXISTS ( SELECT 1 FROM AssetConnection where ChildID = (SELECT ID FROM Asset WHERE AssetKey = 'L1018-S1') AND ParentID = (SELECT ID FROM Asset WHERE AssetKey = 'L1018'))
GO

INSERT INTO AssetConnection (AssetRelationshipTypeID, ChildID, ParentID) SELECT 
1,
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018-S2'),
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018')
WHERE NOT EXISTS ( SELECT 1 FROM AssetConnection where ChildID = (SELECT ID FROM Asset WHERE AssetKey = 'L1018-S2') AND ParentID = (SELECT ID FROM Asset WHERE AssetKey = 'L1018'))
GO

INSERT INTO AssetConnection (AssetRelationshipTypeID, ChildID, ParentID) SELECT 
2,
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006'),
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018')
WHERE NOT EXISTS ( SELECT 1 FROM AssetConnection where ChildID = (SELECT ID FROM Asset WHERE AssetKey = 'S1006') AND ParentID = (SELECT ID FROM Asset WHERE AssetKey = 'L1018'))
GO

INSERT INTO AssetConnection (AssetRelationshipTypeID, ChildID, ParentID) SELECT 
2,
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2'),
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018')
WHERE NOT EXISTS ( SELECT 1 FROM AssetConnection where ChildID = (SELECT ID FROM Asset WHERE AssetKey = 'S1008B2') AND ParentID = (SELECT ID FROM Asset WHERE AssetKey = 'L1018'))
GO

INSERT INTO AssetConnection (AssetRelationshipTypeID, ChildID, ParentID) SELECT 
8,
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1')
WHERE NOT EXISTS ( SELECT 1 FROM AssetConnection where ChildID = (SELECT ID FROM Asset WHERE AssetKey = 'S1006B1012') AND ParentID = (SELECT ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'))
GO

INSERT INTO AssetConnection (AssetRelationshipTypeID, ChildID, ParentID) SELECT 
15, 
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008GEN'),
(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018')
WHERE NOT EXISTS ( SELECT 1 FROM AssetConnection where ChildID = (SELECT ID FROM Asset WHERE AssetKey = 'S1008GEN') AND ParentID = (SELECT ID FROM Asset WHERE AssetKey = 'L1018'))
GO

INSERT INTO Meter (AssetKey, LocationID, Name, Alias, Make, Model, TimeZone, Description) SELECT
'Bludhaven 13-T2',(SELECT ID FROM Location WHERE LocationKey = 'S1004'),'Bludhaven 13-T2',NULL,'Schneider','ION 8650','UTC',NULL
WHERE NOT EXISTS ( SELECT 1 FROM Meter WHERE AssetKey = 'Bludhaven 13-T2')
GO

INSERT INTO Meter (AssetKey, LocationID, Name, Alias, Make, Model, TimeZone, Description) SELECT
'Central City 161-B1044-Caps',(SELECT ID FROM Location WHERE LocationKey = 'S1006'),'Central City 161-B1044-Caps',NULL,'Dranetz','61000','UTC','MeterCentralCity161-B1044-Caps'
WHERE NOT EXISTS ( SELECT 1 FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps')
GO

INSERT INTO Meter (AssetKey, LocationID, Name, Alias, Make, Model, TimeZone, Description) SELECT
'Central City 161-Cap 1 Relay',(SELECT ID FROM Location WHERE LocationKey = 'S1006'),'Central City 161-Cap 1 Relay',NULL,'Dranetz','61000','UTC','MeterCentralCity161-Cap1Relay'
WHERE NOT EXISTS ( SELECT 1 FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay')
GO

INSERT INTO Meter (AssetKey, LocationID, Name, Alias, Make, Model, TimeZone, Description) SELECT
'Bludhaven 13-T1',(SELECT ID FROM Location WHERE LocationKey = 'S1004'),'Bludhaven 13-T1',NULL,'Schneider','ION 8650','UTC','MeterBludhaven13-T1'
WHERE NOT EXISTS ( SELECT 1 FROM Meter WHERE AssetKey = 'Bludhaven 13-T1')
GO

INSERT INTO Meter (AssetKey, LocationID, Name, Alias, Make, Model, TimeZone, Description) SELECT
'Gotham City 161-B1004-Caps',(SELECT ID FROM Location WHERE LocationKey = 'S1003'),'Gotham City 161-B1004-Caps',NULL,'Dranetz','Ion 6589','UTC','MeterGothamCity161-B1004-Caps'
WHERE NOT EXISTS ( SELECT 1 FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps')
GO

INSERT INTO Meter (AssetKey, LocationID, Name, Alias, Make, Model, TimeZone, Description) SELECT
'Gotham City 161-Cap 1-4 Relays',(SELECT ID FROM Location WHERE LocationKey = 'S1003'),'Gotham City 161-Cap 1-4 Relays',NULL,'Dranetz','Ion 6589','UTC','MeterGothamCity161-Cap1-4Relays'
WHERE NOT EXISTS ( SELECT 1 FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays')
GO

INSERT INTO Meter (AssetKey, LocationID, Name, Alias, Make, Model, TimeZone, Description) SELECT
'Gotham City 161-Cap 5 Relay',(SELECT ID FROM Location WHERE LocationKey = 'S1003'),'Gotham City 161-Cap 5 Relay',NULL,'Dranetz','61000','UTC','MeterGothamCity161-Cap5Relay'
WHERE NOT EXISTS ( SELECT 1 FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay')
GO

INSERT INTO Meter (AssetKey, LocationID, Name, Alias, Make, Model, TimeZone, Description) SELECT
'Midway City 2',(SELECT ID FROM Location WHERE LocationKey = 'S1008'),'Midway City 2',NULL,'APP','601','UTC','MeterMidwayCity2'
WHERE NOT EXISTS ( SELECT 1 FROM Meter WHERE AssetKey = 'Midway City 2')
GO

INSERT INTO Meter (AssetKey, LocationID, Name, Alias, Make, Model, TimeZone, Description) SELECT
'Metropolis CC',(SELECT ID FROM Location WHERE LocationKey = 'S1001'),'Metropolis CC',NULL,'APP','501','UTC','MeterMetropolisCC'
WHERE NOT EXISTS ( SELECT 1 FROM Meter WHERE AssetKey = 'Metropolis CC')
GO

INSERT INTO Meter (AssetKey, LocationID, Name, Alias, Make, Model, TimeZone, Description) SELECT
'Central City 161',(SELECT ID FROM Location WHERE LocationKey = 'S1006'),'Central City 161kV Line',NULL,'APP','601','UTC','MeterCentralCity161'
WHERE NOT EXISTS ( SELECT 1 FROM Meter WHERE AssetKey = 'Central City 161')
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,37,1,'V RMS A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,37,2,'V RMS B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,37,3,'V RMS C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,53,9,'I ZERO ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,50,9,'I SPOS ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,46,9,'I SNEG ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),3,22,1,'P A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),3,22,2,'P B ',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),3,22,9,'P All',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),3,66,2,'Q B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),3,66,3,'Q C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),3,66,9,'Q All',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006'),1,37,1,'V RMS A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006'),1,37,2,'V RMS B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006'),1,37,3,'V RMS C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),2,37,1,'I RMS A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),2,37,2,'I RMS B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),2,37,3,'I RMS C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006'),1,53,9,'V ZERO ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006'),1,50,9,'V SPOS ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006'),1,46,9,'V SNEG ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),2,53,9,'I ZERO ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),2,50,9,'I SPOS ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),2,46,9,'I SNEG ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),3,22,1,'P A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),3,22,2,'P B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),3,22,3,'P C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),3,22,9,'P All',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),3,66,1,'Q A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),3,66,2,'Q B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),3,66,3,'Q C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),3,66,9,'Q All',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),1,37,1,'V RMS A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),1,37,2,'V RMS B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),1,37,3,'V RMS C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),2,37,1,'I RMS A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),2,37,2,'I RMS B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),2,37,3,'I RMS C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),1,53,9,'V ZERO ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),1,50,9,'V SPOS ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),1,46,9,'V SNEG ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),2,53,9,'I ZERO ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),2,50,9,'I SPOS ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),2,46,9,'I SNEG ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),3,22,1,'P A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),3,22,2,'P B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),3,22,3,'P C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),3,22,9,'P ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 8 AND MeasurementCharacteristicID = 22 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),3,66,1,'Q A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),3,66,2,'Q B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),3,66,3,'Q C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),3,66,9,'Q ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),1,37,1,'V RMS A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),1,37,2,'V RMS B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),1,37,3,'V RMS C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),2,37,1,'I RMS A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),2,37,2,'I RMS B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),2,37,3,'I RMS C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),1,53,9,'V ZERO ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),1,50,9,'V SPOS ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),1,46,9,'V SNEG ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),2,53,9,'I ZERO ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),2,50,9,'I SPOS ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),2,46,9,'I SNEG ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),3,22,1,'P A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),3,22,2,'P B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),3,22,3,'P C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),3,22,9,'P All',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),3,66,1,'Q A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),3,66,2,'Q B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),3,66,3,'Q C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),3,66,9,'Q All',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),1,37,1,'V RMS A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),1,37,2,'V RMS B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),1,37,3,'V RMS C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),2,37,1,'I RMS A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),2,37,2,'I RMS B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),2,37,3,'I RMS C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),1,53,9,'V ZERO ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),1,53,9,'V ZERO ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),1,50,9,'V SPOS ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),1,46,9,'V SNEG ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),2,53,9,'I ZERO ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),2,50,9,'I SPOS ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),2,46,9,'I SNEG ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),3,22,1,'P A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),3,22,2,'P B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),3,22,3,'P C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),3,22,9,'P All',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),3,66,1,'Q A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),3,66,2,'Q B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),3,66,3,'Q C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),3,66,9,'Q All',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),1,37,1,'5',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),1,37,2,'V RMS B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),1,37,3,'V RMS C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),2,37,1,'I RMS A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),2,37,2,'I RMS B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),2,37,3,'I RMS C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),1,53,9,'V ZERO ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),1,50,9,'V SPOS ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),1,46,9,'V SNEG ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),2,53,9,'I ZERO ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),2,50,9,'I SPOS ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),2,46,9,'I SNEG ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),3,22,1,'P A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),3,22,2,'P B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),3,22,3,'P C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),3,22,9,'P All',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),3,66,1,'Q A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),3,66,2,'Q B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),3,66,3,'Q C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),3,66,9,'Q All',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),1,37,1,'V RMS A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),1,37,2,'V RMS B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),1,37,3,'V RMS C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),2,37,1,'I RMS A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),2,37,2,'I RMS B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),2,37,3,'I RMS C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),1,53,9,'V ZERO ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),1,50,9,'V SPOS ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),1,46,9,'V SNEG ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),2,53,9,'I ZERO ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),2,50,9,'I SPOS ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),2,46,9,'I SNEG ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),3,22,1,'P A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),3,22,2,'P B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),3,22,3,'P C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),3,22,9,'P All',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),3,66,1,'Q A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),3,66,2,'Q B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),3,66,3,'Q C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),3,66,9,'Q All',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,17,1,'V waveform A',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,17,2,'V waveform B',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,17,3,'V waveform C',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,17,1,'I waveform A',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,17,2,'I waveform B',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,17,3,'I waveform C',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,17,8,'I waveform N',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006'),1,17,1,'V waveform A',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006'),1,17,2,'V waveform B',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 34 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006'),1,17,3,'V waveform C',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),2,17,1,'I waveform A',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),2,17,2,'I waveform B',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),2,17,3,'I waveform C',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012'),2,17,8,'I waveform N',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),1,17,1,'V waveform A',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),1,17,2,'V waveform B',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),1,17,3,'V waveform C',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),2,17,1,'I waveform A',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),2,17,2,'I waveform B',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),2,17,3,'I waveform C',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1'),2,17,8,'I waveform N',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),1,17,1,'V waveform A',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),1,17,2,'V waveform B',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),1,17,3,'V waveform C',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),2,17,1,'I waveform A',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),2,17,2,'I waveform B',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),2,17,3,'I waveform C',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),2,17,8,'I waveform N',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'Bludhaven_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),1,17,1,'V waveform A',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),1,17,2,'V waveform B',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),1,17,3,'V waveform B',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),2,17,1,'I waveform A',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),2,17,2,'I waveform B',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),2,17,3,'I waveform C',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000'),2,17,8,'I waveform N',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),1,17,1,'V waveform A',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),1,17,2,'V waveform B',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),1,17,3,'V waveform C',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),2,17,1,'I waveform A',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),2,17,2,'I waveform B',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),2,17,3,'I waveform C',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1'),2,17,8,'I waveform N',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),1,17,1,'V waveform A',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),1,17,2,'V waveform B',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),1,17,3,'V waveform C',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),2,17,1,'I waveform A',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),2,17,2,'I waveform B',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),2,17,3,'I waveform C',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5'),2,17,8,'I waveform N',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),1,17,1,'V1',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),1,17,2,'V2',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),1,17,3,'V3',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),2,17,2,'I2',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),2,17,3,'I3',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1'),2,17,1,'I1',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2'),1,17,1,'Va 161kV',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2'),1,17,2,'Vb 161kV',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2'),1,17,3,'Vc 161kV',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018'),2,17,1,'Ia L1 161kV',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018'),2,17,2,'Ib L1 161kV',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018'),2,17,3,'Ic L1 161kV',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018'),2,17,7,'Ir L1 161kV',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 7)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Metropolis CC'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1001'),4,17,2,'Channel 1',1,2,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Metropolis CC') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1001') AND MeasurementTypeID = 4 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,17,1,'V1',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,17,2,'V2',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,17,3,'V3',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,17,1,'I1',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,17,2,'I2',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,17,3,'I3',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),6,17,4,'Cyclic',0,1,0,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 6 AND MeasurementCharacteristicID = 17 AND PhaseID = 4)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),6,17,4,'Channel 1',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 6 AND MeasurementCharacteristicID = 17 AND PhaseID = 4)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,17,4,'L1-L2 Voltage',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 4)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,17,5,'L2-L3 Voltage',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 5)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,17,6,'L3-L1 Voltage',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 6)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,17,1,'L1 Current',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,17,2,'L2 Current',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,17,3,'L3 Current',0,1,0,0,1,0,0
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,37,4,'L1-L2 Voltage',0,1,0,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 4)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,37,5,'L2-L3 Voltage',0,1,0,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 5)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,37,6,'L3-L1 Voltage',0,1,0,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 6)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,37,1,'L1 Current',0,1,0,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,37,2,'L2 Current',0,1,0,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,37,3,'L3 Current',0,1,0,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,14,1,'Frequency',0,1,0,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 14 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,37,1,'I RMS A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,37,2,'I RMS B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),2,37,3,'I RMS C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,53,9,'V ZERO ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,50,9,'V SPOS ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),1,46,9,'V SNEG ALL',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),3,22,2,'P B',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),3,22,3,'P C',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3)
GO

INSERT INTO Channel (MeterID, AssetID, MeasurementTypeID, MeasurementCharacteristicID, PhaseID, Name, Adder, Multiplier, SamplesPerHour, HarmonicGroup, Enabled, ConnectionPriority, Trend) SELECT
(SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2'),(SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1'),3,66,1,'Q A',0,1,6,0,1,0,1
WHERE NOT EXISTS ( SELECT 1 FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 2, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 2, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 2, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 2, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 2, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 2, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 2, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 2, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 2, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 2, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 5 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 2, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 33), 2, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 2, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 2, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 2, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 2, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 2, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT 
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 2, 'V ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 2, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 2, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 2, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 2, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 2, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 2, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 2, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 2, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 2, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 2, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 2, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 2, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 2, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 2, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 2, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 2, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 2, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 2, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 2, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 2, 'V ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 2, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 2, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 2, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 2, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 2, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 2, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 2, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 2, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 2, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 8 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 2, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 8 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 2, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 2, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 2, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 2, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 2, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 2, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 2, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 2, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 2, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 2, 'V ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 2, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 2, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 2, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 2, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 2, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 2, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 2, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 2, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 2, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 2, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 2, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 2, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 2, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 2, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 2, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 2, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 2, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 2, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 2, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 2, 'V ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 2, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 2, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 2, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 2, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 2, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 2, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 2, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 2, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 2, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 2, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 2, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 2, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 2, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 2, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 2, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 2, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 2, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 2, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 2, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 2, 'V ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 2, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 2, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 2, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 2, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 2, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 2, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 2, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 2, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 2, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 2, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 2, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 2, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 2, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 2, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 2, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 2, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 2, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 2, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 2, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 2, 'V SZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 2, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 2, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 2, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 2, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 2, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 2, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 2, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 2, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 2, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 2, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 2, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 2, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 2, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 2, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 2)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 3, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 3, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 3, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 3, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 3, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 3, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 3, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 3, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 3, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 3, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 5 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 3, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 33), 3, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 3, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 3, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 3, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 3, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 3, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT 
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 3, 'V ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 3, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 3, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 3, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 3, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 3, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 3, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 3, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 3, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 3, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 3, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 3, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 3, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 3, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 3, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 3, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 3, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 3, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 3, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 3, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 3, 'V ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 3, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 3, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 3, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 3, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 3, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 3, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 3, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 3, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 3, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 8 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 3, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 3, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 3, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 3, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 3, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 3, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 3, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 3, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 3, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 3, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 3, 'V ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 3, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 3, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 3, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 3, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 3, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 3, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 3, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 3, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 3, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 3, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 3, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 3, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 3, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 3, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 3, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 3, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 3, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 3, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 3, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 3, 'V ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 3, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 3, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 3, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 3, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 3, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 3, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 3, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 3, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 3, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 3, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 3, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 3, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 3, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 3, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 3, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 3, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 3, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 3, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 3, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 3, 'V ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 3, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 3, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 3, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 3, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 3, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 3, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 3, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 3, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 3, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 3, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 3, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 3, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 3, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 3, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 3, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 3, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 3, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 3, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 3, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 3, 'V SZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 3, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 3, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 3, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 3, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 3, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 3, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 3, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 3, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 3, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 3, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 3, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 3, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 3, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 3, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 3)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 4, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 4, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 4, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 4, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 4, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 4, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 4, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 4, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 4, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 4, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 5 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 4, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 33), 4, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 4, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 4, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 4, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 4, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 4, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT 
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 4, 'V ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 4, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 4, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 4, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 4, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 4, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 4, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 4, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 4, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 4, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 4, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 4, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 4, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 4, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 4, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1028') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 4, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 4, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 4, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 4, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 4, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 4, 'V ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 4, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 4, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 4, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 4, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 4, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 4, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 4, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 4, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 4, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 8 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 4, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 4, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 4, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 4, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 4, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 4, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 4, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 4, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 4, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 4, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 4, 'V ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 4, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 4, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 4, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 4, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 4, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 4, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 4, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 4, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 4, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 4, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 4, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 4, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 4, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 4, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 4, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 4, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 4, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 4, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 4, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 4, 'V ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 4, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 4, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 4, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 4, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 4, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 4, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 4, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 4, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 4, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 4, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 4, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 4, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 4, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 4, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 4, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 4, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 4, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 4, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 4, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 4, 'V ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 4, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 4, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 4, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 4, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 4, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 4, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 4, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 4, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 4, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 4, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 4, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 4, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 4, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 4, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 4, 'V RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 4, 'V RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 4, 'V RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 4, 'V SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 4, 'V SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 4, 'V SZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 4, 'I RMS A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 4, 'I RMS B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 4, 'I RMS C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9), 4, 'I SNEG All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 46 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9), 4, 'I SPOS All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 50 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9), 4, 'I ZERO All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 53 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1), 4, 'P A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2), 4, 'P B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3), 4, 'P C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9), 4, 'P All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 22 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1), 4, 'Q A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 1) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2), 4, 'Q B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 2) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3), 4, 'Q C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 3) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9), 4, 'Q All'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 3 AND MeasurementCharacteristicID = 66 AND PhaseID = 9) AND SeriesTypeID = 4)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, 'V waveform A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, 'V waveform B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, 'V waveform C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, 'I waveform A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, 'I waveform B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, 'I waveform C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8), 1, 'I waveform N'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, 'V waveform A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, 'V waveform B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, 'V waveform C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, 'I waveform A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, 'I waveform B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, 'I waveform C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8), 1, 'I waveform N'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-B1044-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, 'V waveform A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, 'V waveform B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, 'V waveform C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, 'I waveform A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, 'I waveform B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, 'I waveform C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8), 1, 'I waveform N'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Central City 161-Cap 1 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1006B1012CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, 'V waveform A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, 'V waveform B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, 'V waveform C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, 'I waveform A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, 'I waveform B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, 'I waveform C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8), 1, 'I waveform N'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, 'V waveform A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, 'V waveform B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, 'V waveform C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, 'I waveform A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, 'I waveform B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, 'I waveform C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8), 1, 'I waveform N'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-B1004-Caps') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, 'V waveform A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, 'V waveform B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, 'V waveform C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, 'I waveform A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, 'I waveform B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, 'I waveform C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8), 1, 'I waveform N'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 1-4 Relays') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, 'V waveform A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, 'V waveform B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, 'V waveform C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, 'I waveform A'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, 'I waveform B'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, 'I waveform C'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8), 1, 'I waveform N'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Gotham City 161-Cap 5 Relay') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1003B1000CR5') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 8) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, 'V1'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, 'V2'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, 'V3'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T1') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'BLUDHAVEN_13-T1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, '45'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, '46'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, '47'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'S1008B2') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, '41'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, '42'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, '43'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 7), 1, '44'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Midway City 2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1018') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 7) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Metropolis CC') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1001') AND MeasurementTypeID = 4 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, 'A1'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Metropolis CC') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'L1001') AND MeasurementTypeID = 4 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 6 AND MeasurementCharacteristicID = 17 AND PhaseID = 4), 1, 'A1'
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 6 AND MeasurementCharacteristicID = 17 AND PhaseID = 4) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 4), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 4) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 5), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 5) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 6), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 17 AND PhaseID = 6) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 17 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 4), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 4) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 5), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 5) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 6), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 37 AND PhaseID = 6) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 2) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 2 AND MeasurementCharacteristicID = 37 AND PhaseID = 3) AND SeriesTypeID = 1)
GO

INSERT INTO Series (ChannelID, SeriesTypeID, SourceIndexes) SELECT
(SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 14 AND PhaseID = 1), 1, ''
WHERE NOT EXISTS ( SELECT 1 FROM Series WHERE ChannelID = (SELECT Channel.ID  FROM Channel WHERE MeterID = (SELECT Meter.ID FROM Meter WHERE AssetKey = 'Bludhaven 13-T2') AND AssetID = (SELECT Asset.ID FROM Asset WHERE AssetKey = 'XFR-1') AND MeasurementTypeID = 1 AND MeasurementCharacteristicID = 14 AND PhaseID = 1) AND SeriesTypeID = 1)
GO

INSERT INTO MeterAsset (MeterID, AssetID) SELECT DISTINCT Channel.MeterID, Channel.AssetID FROM Channel WHERE NOT EXISTS (SELECT 1 FROM MeterAsset WHERE MeterID = Channel.MeterID AND AssetID = Channel.AssetID)
GO